home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CUJ9206.ARJ / 1006046A < prev    next >
Text File  |  1992-06-02  |  2KB  |  78 lines

  1. LISTING ONE
  2.  
  3. #ifndef CHANNEL_HPP
  4. #define    CHANNEL_HPP
  5.  
  6. extern "C" {
  7.     #include    "d40.h"
  8.     #include    "d40lib.h"
  9.     #include    <stdlib.h>
  10.     #include    <bios.h>
  11.     #include    <dos.h>
  12.     #include    <io.h>
  13.     #include    <fcntl.h>
  14.     #include    <stdio.h>
  15.     #include    <string.h>
  16.     #include    <sys\stat.h>
  17. }
  18.  
  19.  
  20. // maximum number of touchtones to get
  21. #define    MAXDIGITS        8
  22. // output extension for voice files
  23. #define    SPEECH_EXT        ".VOX"        
  24. // used to store user recordings
  25. #define    RECORD_FNAME    "OUTPUT"
  26.  
  27. class CHANNEL {
  28.     private:
  29.         int lineno;                
  30.         char msgname[9];    // message filename
  31.  
  32.         // buffer for keypad digits
  33.            unsigned char digits[MAXDIGITS+1];  
  34.         RWB rwb;         // speech card read/write block
  35.         
  36.         // begin and end function pointers for state
  37.         // transition processing
  38.         int (CHANNEL::*begin_func)();
  39.         void (CHANNEL::*end_func)(int evtcode);
  40.  
  41.     public:
  42.         void prep(int line);
  43.         int play();
  44.  
  45.         int begin_state();
  46.         void cmplt_state(int evtcode);
  47.  
  48.         // the states used in sample application
  49.         int wait_for_ring();
  50.         void wait_complete(int evtcode);
  51.         int offhook();
  52.         void offhook_cmplt(int evtcode);
  53.         int onhook();
  54.         void onhook_cmplt(int evtcode);
  55.         int hello();
  56.         void hello_cmplt(int evtcode);
  57.         int get_digits();
  58.         void get_digits_cmplt(int evtcode);
  59.         int product_info();
  60.         void product_info_cmplt(int evtcode);
  61.         int playback();
  62.         void playback_cmplt(int evtcode);
  63.         int invalid();
  64.         void invalid_cmplt(int evtcode);
  65.         int rec_msg();
  66.         void rec_msg_cmplt(int evtcode);
  67.         int goodbye();
  68.         void goodbye_cmplt(int evtcode);
  69. };
  70.  
  71. // typedefs used for accessing function pointers
  72. typedef int  (CHANNEL::*INTPROC)();
  73. typedef void (CHANNEL::*VOIDPROC)(int);
  74.  
  75.  
  76. #endif
  77.  
  78.